import com.antgroup.zmxy.openplatform.api.DefaultZhimaClient;
import com.antgroup.zmxy.openplatform.api.FileItem;
import com.antgroup.zmxy.openplatform.api.ZhimaApiException;
import com.antgroup.zmxy.openplatform.api.request.ZhimaDataBatchFeedbackRequest;
import com.antgroup.zmxy.openplatform.api.response.ZhimaDataBatchFeedbackResponse;

public class TestZhimaDataBatchFeedback {
    //芝麻开放平台地址
    private String gatewayUrl     = "https://zmopenapi.zmxy.com.cn/openapi.do";
    //商户应用 Id
    private String appId          = "1004084";
    //商户 RSA 私钥
//    private String privateKey     = "***";
    //芝麻 RSA 公钥
//    private String zhimaPublicKey = "***";
	
	 //商户 RSA 私钥
    private static String privateKey = "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAL5llACtrWWuyUjP0kMks6zcAwzleTYiDavqXpRGPxeEbPCMw/9+ZKnOLpSIFpqrWsnYWDdb24jPMf2iOYW9BKGBB/+/ptwF5jk7bZqQzGnAgQuCNLC26R5tUjIK9hFLi7bULSFkJzw1GVdwhwK0psUMXnScpmjCsCNiFlTwvWYrAgMBAAECgYAkjk4/XxlGx6tf7n75Y0eYLdnsFPcT3K/xTRuBrocYldVwziYnnPXo4GxzGjn00mepD3/IiTt6ZgW8I/SVZ/hGUSpq9XRWtpgwq3T5kCDTRTnKXBahhcuG0FuAFgh+sxBEFCSNuIfGOydKNroM4O4xNFppDX0p5y3rjXMRC7eXcQJBAObC1BPMYTq4/TgPeHe2rb9C7bosdLV8fopqvhyb1B7RoU9Kxma+rFwqtl9LLFxM7WHUtEnRJMnPT5zjQEuWhEkCQQDTOJMWSr1NcnZ4pJuI3028AfcBpi4KUGTOnSTrwcJhvxYE9n/qB68uFdjAQXCul3GvtqohGw+Y72uD9g5iH27TAkBm3k0qMj7ZraN7/TGHtFDJ5S0ShETWrpO+Yo0zNagewPZ24W+GV9OAFq5L1rgEwWpE5UwlZ+1NZXQpDQkZaRS5AkAZ1pTfqDrqC3OEpJZGMxLeSds+f2aoalc6kyyeDnDJ5kc6SjExnskGOTPvqNGw+eO1XAIJ1LaevcMIPIRb6n5zAkBTwZ3i2+QgF4Q9NR6yDtGfHb1JanL7SeQuafviym4WZZYv/698hiNG4bD+jNgmHYz6O8MCHySYfArmIXYA06PN";
	  //芝麻 RSA 公钥
    private static String zhimaPublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDEkjxzwanftpckU+bEtK6O4eNzqgcfQy2CtpxAXbIUsQNafvbWOCUdirU86DMc/cg/nb2NFybzAdpVhMOaJWQGVdZZ7H453k+hf6DKUs8L/Wy0/vsusxHq5pDOVDSZPoRkdkWtE+ZhOvdPvLIJuVDsq8125Kaw0hjU2UvXkjyYjQIDAQAB";


    public void  testZhimaDataBatchFeedback() {
        ZhimaDataBatchFeedbackRequest req = new ZhimaDataBatchFeedbackRequest();
        req.setChannel("apppc");
        req.setPlatform("zmop");
        req.setFileType("json_data");// 必要参数 
        req.setFileCharset("UTF-8");// 必要参数 
        req.setRecords("2");// 必要参数 
        req.setColumns("user_name,user_credentials_type,user_credentials_no,order_no,biz_type,order_status,create_amt,pay_month,gmt_ovd_date,overdue_cnt,overdue_amt,gmt_pay,memo");// 必要参数 
        req.setPrimaryKeyColumns("order_no,pay_month");// 必要参数 
        req.setFileDescription("文件描述信息");// 
        req.setTypeId("1004084-default-test");// 必要参数 
        req.setBizExtParams("{\"extparam1\":\"value1\"}");// 
        req.setFile(new FileItem("C:/TEMP/zmdata.json"));// 必要参数 
        DefaultZhimaClient client = new DefaultZhimaClient(gatewayUrl, appId, privateKey, zhimaPublicKey);
        try {
            ZhimaDataBatchFeedbackResponse response = client.execute(req);
            
            System.out.println(response.getBody());
            System.out.println(response.getBizSuccess());
            System.out.println(response.getParams());
            System.out.println(response.isSuccess());
            System.out.println(response.getErrorCode());
            System.out.println(response.getErrorMessage());
        } catch (ZhimaApiException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        TestZhimaDataBatchFeedback result = new  TestZhimaDataBatchFeedback();
        result.testZhimaDataBatchFeedback();
    }
}